package com.wyw.design.model.learning.behavioral.visitor;

import java.util.LinkedList;
import java.util.List;

/**
 * @Title   存储设备    ObjectStructure角色
 * @Description
 * @Author Mr Wu yewen.wu.china@gmail.com
 * @Date 2023/4/19 17:19
 * Update History:
 * Author        Time            Content
 */
public class Computor {
    // 计算机中的文件和文件夹List
    private List<Element> elementList = new LinkedList<>();
    {
        elementList.add(new FileElement("Java讲义.pdf", "look-file"));
        elementList.add(new DictionaryElement("program", "look-dictionary"));
    }
    // 展示该电脑中的文件和文件夹
    void showFileAndDict(Visitor visitor) {
        for (Element element: elementList) {
            element.accept(visitor);
        }
    }
}
